package chapter15;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/2/23 9:06
 */
public class HelloRunnable implements Runnable {

    public static void main(String[] args) {
        Thread thread = new Thread(new HelloRunnable());
        thread.setName("hello-runnable");
        thread.start();
        try {
            thread.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void run() {
        Thread current = Thread.currentThread();
        System.out.println("current thread name:" + current.getName());
        System.out.println("is deamon?" + current.isDaemon());
        System.out.println("current thread id:" + current.getId());
        System.out.println("priority:" + current.getPriority());
        System.out.println("state:" + current.getState());
        System.out.println("is alive?" + current.isAlive());
        System.out.println("hello runnable");
    }
}
